/**
 * @description 详情弹窗通用
 * */
export default {
  props: {
    visible: {
      type: Boolean,
      default: false
    },
    opId: {
      type: Number,
      default: 0
    }
  },
  data() {
    return {
      detailData: {}
    }
  },
  methods: {
    close(flag = false) {
      if (this.visible) {
        this.$emit('close', flag)
      }
    },
    async open() {
      await this.getDetail()
    },
    async getDetail() {
      const { data, success, message } = await this.detailFunc(this.opId)
      if (success) {
        this.detailData = data
      } else {
        this.$message({ type: 'error', message })
      }
    }
  }
}
